package cc.mrbird.assets.service;

import cc.mrbird.assets.domain.Element;
import cc.mrbird.common.domain.QueryRequest;
import org.springframework.cache.annotation.CacheConfig;
import org.springframework.cache.annotation.CacheEvict;
import org.springframework.cache.annotation.Cacheable;

import java.util.List;

@CacheConfig(cacheNames = "ElementService")
public interface ElementService {
    List<Element> findAllList(Element element, QueryRequest request);

    Element findByName(String element_name);

    @CacheEvict(allEntries = true)
    void add(Element element);

    @CacheEvict(key = "#p0", allEntries = true)
    void update(Element element);

    @CacheEvict(key = "#p0", allEntries = true)
    void delete(String ids);

    @Cacheable(key = "#p0")
    public Element findById(Long id);
}
